﻿@model IEnumerable<com.fmtx.Model.Place>
@{
    ViewBag.Title = "Index";
}
@using fmtx.Utility;
<div class="widget stacked widget-table action-table">
    <div class="widget-header">
        <i class="icon-th-list"></i>
        <h3>景点信息 <a href="/admin/city/edit" ><i class="icon-plus">添加</i></a></h3>
        <div style="float:right;margin-right:10px;">
           <form class="form-inline" style="margin:0;">
                名称：<input type="text" name="name" class="input-small" placeholder="景点名称" value="@Request.QueryString["name"]" />
               城市：<input type="text" name="city" class="input-small" placeholder="请选择城市" value="@Request.QueryString["city"]" />
               <input type="hidden" name="cityid" value="@Request.QueryString["cityid"]" />
               <button class="btn btn-small" ><i class="btn-icon-only icon-search" style="margin-left:0px;" ></i>搜索</button>
           </form>
        </div>
    </div>
    <!-- /widget-header -->
    <div class="widget-content">
        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th>#</th>
                    <th>图标</th>
                    <th>名称</th>
                    <th>所属城市</th>
                    <th>简介</th>
                    <th>经度</th>
                    <th>纬度</th>
                    <th class="td-actions"></th>
                </tr>
            </thead>
            <tbody>
            @if(Model!=null){
                foreach (var item in Model)
                {
                    <tr>
                        <td>@item.Id</td>
                        <td><img width="50" src="@StaticCs.ImageUrl/img/Artwork?file=@item.Pic" /></td>
                        <td>@item.Name</td>
                        <td>@item.CityName</td>
                        <td title="@item.Summary" >@item.Summary.RemoveHtml(40)</td>
                        <td>@item.Lat</td>
                        <td>@item.Lng</td>
                        <td class="td-actions">
                            <a title="编辑" href="/admin/place/edit/@item.Id" class="btn btn-small btn-warning">
                                <i class="btn-icon-only icon-edit"></i>
                            </a>

                            <a title="删除" href="javascript:;" onclick="" class="btn btn-small">
                                <i class="btn-icon-only icon-remove"></i>
                            </a>
                        </td>
                    </tr>
                }
            } 
            </tbody>
        </table>
       <div class="pagination pagination-right"  > <ul id="Pager"></ul></div>
    </div>
    <!-- /widget-content -->

</div>
@section scripts{
    <script type="text/javascript">
        function initPagination() {
            var num_entries = parseInt("@ViewBag.count");
            $("#Pager").pagination(num_entries, {
                link_to: "/admin/place/?index=__id__&name=@Request.QueryString["name"]&country=@Request.QueryString["country"]&countryId=@Request.QueryString["countryId"]",
                current_page: parseInt("@(Request.QueryString["index"]??"0")"),
                items_per_page: 12,
                prev_text: '上一页',
                next_text: '下一页 ',
                first_text: "首页",
                last_text: "尾页"
            });
        }
        $(document).ready(function () {
            initPagination();
        });
    </script>
    }